package restlike.demo.shoreditchairways

import im.mange.shoreditch.api.liftweb.ServiceHelper
import ServiceHelper._
import im.mange.shoreditch.api._
import im.mange.shoreditch.api.liftweb.ServiceHelper

object Seating extends ServiceHelper(base = "seating", version = "10001")(
  "seat/reserved/@pnr/@seat" check SeatConfirmed
)

case class SeatConfirmed(pnr: String, seat: String) extends Check {
  override def run =
    if (DemoState.bookings.exists(b=> b.ref == pnr && b.seatReserved)) success
    else failure(List("No seat found for pnr: " + pnr))
}